🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / ui / src / commonMain / kotlin / org / meshtastic / core / ui / qr / ScannedQrCodeViewModel.kt
Displaying Raw • Download
core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/qr/ScannedQrCodeViewModel.kt 7a0915ebe99a4704e871fa5711964def956af182 (7a0915eb) Text, 2.49 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.qr
Tff7b72import T7ee787androidx.lifecycle.ViewModel
Tff7b72import T7ee787org.koin.core.annotation.KoinViewModel
Tff7b72import T7ee787org.meshtastic.core.model.RadioController
Tff7b72import T7ee787org.meshtastic.core.repository.RadioConfigRepository
Tff7b72import T7ee787org.meshtastic.core.ui.util.getChannelList
Tff7b72import T7ee787org.meshtastic.core.ui.viewmodel.safeLaunch
Tff7b72import T7ee787org.meshtastic.core.ui.viewmodel.stateInWhileSubscribed
Tff7b72import T7ee787org.meshtastic.proto.Channel
Tff7b72import T7ee787org.meshtastic.proto.ChannelSet
Tff7b72import T7ee787org.meshtastic.proto.Config
Tff7b72import T7ee787org.meshtastic.proto.LocalConfig
Tf0883e@KoinViewModel
Tff7b72class T56d364ScannedQrCodeViewModelTb4b4b4(
Tff7b72private Tff7b72val Te6edf3radioConfigRepositoryTb4b4b4: Te6edf3RadioConfigRepositoryTb4b4b4,
Tff7b72private Tff7b72val Te6edf3radioControllerTb4b4b4: Te6edf3RadioControllerTb4b4b4,
Tb4b4b4) Tb4b4b4: Te6edf3ViewModelTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3channels Tff7b72= Te6edf3radioConfigRepositoryTb4b4b4.Te6edf3channelSetFlowTb4b4b4.Te6edf3stateInWhileSubscribedTb4b4b4(Te6edf3initialValue Tff7b72= Te6edf3ChannelSetTb4b4b4(Tb4b4b4)Tb4b4b4)
Tff7b72private Tff7b72val Te6edf3localConfig Tff7b72= Te6edf3radioConfigRepositoryTb4b4b4.Te6edf3localConfigFlowTb4b4b4.Te6edf3stateInWhileSubscribedTb4b4b4(Te6edf3initialValue Tff7b72= Te6edf3LocalConfigTb4b4b4(Tb4b4b4)Tb4b4b4)
T8b949e/** Set the radio config (also updates our saved copy in preferences). */
Tff7b72fun Td2a8ffsetChannelsTb4b4b4(Te6edf3channelSetTb4b4b4: Te6edf3ChannelSetTb4b4b4) Tff7b72= Te6edf3safeLaunchTb4b4b4(Te6edf3tag Tff7b72= Ta5d6ff"Ta5d6ffsetChannelsTa5d6ff"Tb4b4b4) Tb4b4b4{
Te6edf3getChannelListTb4b4b4(Te6edf3channelSetTb4b4b4.Te6edf3settingsTb4b4b4, Te6edf3channelsTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3settingsTb4b4b4)Tb4b4b4.Te6edf3forEachTb4b4b4(Tff7b72::Te6edf3setChannelTb4b4b4)
Te6edf3radioConfigRepositoryTb4b4b4.Te6edf3replaceAllSettingsTb4b4b4(Te6edf3channelSetTb4b4b4.Te6edf3settingsTb4b4b4)
Tff7b72val Te6edf3loraConfig Tff7b72= Te6edf3channelSetTb4b4b4.Te6edf3lora_config
Tff7b72if Tb4b4b4(Te6edf3loraConfig Tff7b72!Tff7b72= Tff7b72null Tff7b72&Tff7b72& Te6edf3localConfigTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3lora Tff7b72!Tff7b72= Te6edf3loraConfigTb4b4b4) Tb4b4b4{
Te6edf3setConfigTb4b4b4(Te6edf3ConfigTb4b4b4(Te6edf3lora Tff7b72= Te6edf3loraConfigTb4b4b4)Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tff7b72private Tff7b72fun Td2a8ffsetChannelTb4b4b4(Te6edf3channelTb4b4b4: Te6edf3ChannelTb4b4b4) Tb4b4b4{
Te6edf3safeLaunchTb4b4b4(Te6edf3tag Tff7b72= Ta5d6ff"Ta5d6ffsetChannelTa5d6ff"Tb4b4b4) Tb4b4b4{ Te6edf3radioControllerTb4b4b4.Te6edf3setLocalChannelTb4b4b4(Te6edf3channelTb4b4b4) Tb4b4b4}
Tb4b4b4}
T8b949e// Set the radio config (also updates our saved copy in preferences)
Tff7b72private Tff7b72fun Td2a8ffsetConfigTb4b4b4(Te6edf3configTb4b4b4: Te6edf3ConfigTb4b4b4) Tb4b4b4{
Te6edf3safeLaunchTb4b4b4(Te6edf3tag Tff7b72= Ta5d6ff"Ta5d6ffsetConfigTa5d6ff"Tb4b4b4) Tb4b4b4{ Te6edf3radioControllerTb4b4b4.Te6edf3setLocalConfigTb4b4b4(Te6edf3configTb4b4b4) Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s